<template>
	<div id="" class="full">
		<div class="search">
			<form action="/">
				<van-search v-model="searchvalue" show-action placeholder="请输入搜索关键词" @cancel="onCancel">
					<template #action>
						<div @click="onSearch">搜索</div>
					</template>
				</van-search>
			</form>
		</div>
	</div>
</template>

<script>
	export default {
		name: "search",
		data() {
			return {
				show: false,
				searchvalue: '',
				random:Math.random()
			}
		},
		methods: {
			// 搜索框
			onSearch(val) {
				// this.$toast("123")
				// console.log(this.searchvalue)
				// this.$router.push({
				// 	name: "market", //这个name就是你刚刚配置在router里边的name
				// 	params: {
				// 		name: 13,
				// 	},
				// 	query: {
				// 		random:this.random
				// 	},
				// })
				this.$store.commit('setStateSearch', this.searchvalue)
				this.$router.push("/market")
			},
			onCancel() {
				Toast("取消")
			},

		}
	}
</script>

<style>
	* {
		margin: 0;
		padding: 0;
	}

	.full {
		width: 100%;
	}
</style>
